export function transformData (inputData) {
  const subwayline = [];

  subwayline.push({
    text: '不限制',
    children: [{ text: '全广州', id: '' }],
  });

  // Process the data
  inputData.forEach(entry => {
    const lineNum = entry.subwayNum;
    const lineName = lineNum;
    const stationList = entry.subwayName.map((name, index) => ({
      text: name,
      id: name,
    }));

    subwayline.push({
      text: lineName,
      children: stationList,
    });
  });

  return subwayline;
}

export function modifyStationsData (data) {
  for (let i = 0; i < data.length; i++) {
    const line = data[i];

    for (let j = 0; j < line.stations.length; j++) {
      const station = line.stations[j];

      station.lineName = station.stationName;
      station.lineId = station.stationShowCode;

      delete station.hcLines;
    }
  }

  return data;
}
